package com.watchthelan.web.schedule.event;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.mvc.SimpleFormController;

import com.watchthelan.domain.Event;
import com.watchthelan.service.schedule.event.EventManager;

public class EventDeleteFormController extends SimpleFormController {
	EventManager eventManager;

	public void setEventManager(EventManager eventManager) {
		this.eventManager = eventManager;
	}
	
	protected Object formBackingObject(HttpServletRequest request) throws ServletException {
		logger.info("delete event");
		Event event = new Event();
		String id = request.getParameter("id");
		if (id != null) {
			eventManager.deleteEventById(new Long(id));
		}
		return event;
	}

}
